
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _NOTAS
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "NOTAS"
			Me.MappingName = "NOTAS"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_NOTASLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodNota As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_NOTAS.Parameters.CodNota, CodNota)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_NOTASLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodNota As SqlParameter
                Get
                    Return New SqlParameter("@CodNota", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property NroNota As SqlParameter
                Get
                    Return New SqlParameter("@NroNota", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodCliente As SqlParameter
                Get
                    Return New SqlParameter("@CodCliente", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Fecha As SqlParameter
                Get
                    Return New SqlParameter("@Fecha", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodEstadoNota As SqlParameter
                Get
                    Return New SqlParameter("@CodEstadoNota", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodContacto As SqlParameter
                Get
                    Return New SqlParameter("@CodContacto", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Total As SqlParameter
                Get
                    Return New SqlParameter("@Total", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodTipoNota As SqlParameter
                Get
                    Return New SqlParameter("@CodTipoNota", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property DireccionEntrega As SqlParameter
                Get
                    Return New SqlParameter("@DireccionEntrega", SqlDbType.NVarChar, 250)
                End Get
            End Property

            Public Shared ReadOnly Property FechaVencimiento As SqlParameter
                Get
                    Return New SqlParameter("@FechaVencimiento", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodOrdenCompra As SqlParameter
                Get
                    Return New SqlParameter("@CodOrdenCompra", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Observaciones As SqlParameter
                Get
                    Return New SqlParameter("@Observaciones", SqlDbType.Text, 2147483647)
                End Get
            End Property

            Public Shared ReadOnly Property CodUsuario As SqlParameter
                Get
                    Return New SqlParameter("@CodUsuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property FechaActualizacion As SqlParameter
                Get
                    Return New SqlParameter("@FechaActualizacion", SqlDbType.DateTime, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodNota As String = "codNota"
            Public Const NroNota As String = "nroNota"
            Public Const CodCliente As String = "codCliente"
            Public Const Fecha As String = "fecha"
            Public Const CodEstadoNota As String = "codEstadoNota"
            Public Const CodContacto As String = "codContacto"
            Public Const Total As String = "total"
            Public Const CodTipoNota As String = "codTipoNota"
            Public Const DireccionEntrega As String = "direccionEntrega"
            Public Const FechaVencimiento As String = "fechaVencimiento"
            Public Const CodOrdenCompra As String = "codOrdenCompra"
            Public Const Observaciones As String = "observaciones"
            Public Const CodUsuario As String = "codUsuario"
            Public Const FechaActualizacion As String = "fechaActualizacion"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodNota) = _NOTAS.PropertyNames.CodNota
                    ht(NroNota) = _NOTAS.PropertyNames.NroNota
                    ht(CodCliente) = _NOTAS.PropertyNames.CodCliente
                    ht(Fecha) = _NOTAS.PropertyNames.Fecha
                    ht(CodEstadoNota) = _NOTAS.PropertyNames.CodEstadoNota
                    ht(CodContacto) = _NOTAS.PropertyNames.CodContacto
                    ht(Total) = _NOTAS.PropertyNames.Total
                    ht(CodTipoNota) = _NOTAS.PropertyNames.CodTipoNota
                    ht(DireccionEntrega) = _NOTAS.PropertyNames.DireccionEntrega
                    ht(FechaVencimiento) = _NOTAS.PropertyNames.FechaVencimiento
                    ht(CodOrdenCompra) = _NOTAS.PropertyNames.CodOrdenCompra
                    ht(Observaciones) = _NOTAS.PropertyNames.Observaciones
                    ht(CodUsuario) = _NOTAS.PropertyNames.CodUsuario
                    ht(FechaActualizacion) = _NOTAS.PropertyNames.FechaActualizacion

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodNota As String = "CodNota"
            Public Const NroNota As String = "NroNota"
            Public Const CodCliente As String = "CodCliente"
            Public Const Fecha As String = "Fecha"
            Public Const CodEstadoNota As String = "CodEstadoNota"
            Public Const CodContacto As String = "CodContacto"
            Public Const Total As String = "Total"
            Public Const CodTipoNota As String = "CodTipoNota"
            Public Const DireccionEntrega As String = "DireccionEntrega"
            Public Const FechaVencimiento As String = "FechaVencimiento"
            Public Const CodOrdenCompra As String = "CodOrdenCompra"
            Public Const Observaciones As String = "Observaciones"
            Public Const CodUsuario As String = "CodUsuario"
            Public Const FechaActualizacion As String = "FechaActualizacion"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodNota) = _NOTAS.ColumnNames.CodNota
                    ht(NroNota) = _NOTAS.ColumnNames.NroNota
                    ht(CodCliente) = _NOTAS.ColumnNames.CodCliente
                    ht(Fecha) = _NOTAS.ColumnNames.Fecha
                    ht(CodEstadoNota) = _NOTAS.ColumnNames.CodEstadoNota
                    ht(CodContacto) = _NOTAS.ColumnNames.CodContacto
                    ht(Total) = _NOTAS.ColumnNames.Total
                    ht(CodTipoNota) = _NOTAS.ColumnNames.CodTipoNota
                    ht(DireccionEntrega) = _NOTAS.ColumnNames.DireccionEntrega
                    ht(FechaVencimiento) = _NOTAS.ColumnNames.FechaVencimiento
                    ht(CodOrdenCompra) = _NOTAS.ColumnNames.CodOrdenCompra
                    ht(Observaciones) = _NOTAS.ColumnNames.Observaciones
                    ht(CodUsuario) = _NOTAS.ColumnNames.CodUsuario
                    ht(FechaActualizacion) = _NOTAS.ColumnNames.FechaActualizacion

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodNota As String = "s_CodNota"
            Public Const NroNota As String = "s_NroNota"
            Public Const CodCliente As String = "s_CodCliente"
            Public Const Fecha As String = "s_Fecha"
            Public Const CodEstadoNota As String = "s_CodEstadoNota"
            Public Const CodContacto As String = "s_CodContacto"
            Public Const Total As String = "s_Total"
            Public Const CodTipoNota As String = "s_CodTipoNota"
            Public Const DireccionEntrega As String = "s_DireccionEntrega"
            Public Const FechaVencimiento As String = "s_FechaVencimiento"
            Public Const CodOrdenCompra As String = "s_CodOrdenCompra"
            Public Const Observaciones As String = "s_Observaciones"
            Public Const CodUsuario As String = "s_CodUsuario"
            Public Const FechaActualizacion As String = "s_FechaActualizacion"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodNota As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodNota)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodNota, Value)
            End Set
        End Property

        Public Overridable Property NroNota As Integer
            Get
                Return MyBase.Getint(ColumnNames.NroNota)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.NroNota, Value)
            End Set
        End Property

        Public Overridable Property CodCliente As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodCliente)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodCliente, Value)
            End Set
        End Property

        Public Overridable Property Fecha As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fecha)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fecha, Value)
            End Set
        End Property

        Public Overridable Property CodEstadoNota As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodEstadoNota)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodEstadoNota, Value)
            End Set
        End Property

        Public Overridable Property CodContacto As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodContacto)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodContacto, Value)
            End Set
        End Property

        Public Overridable Property Total As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.Total)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.Total, Value)
            End Set
        End Property

        Public Overridable Property CodTipoNota As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodTipoNota)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodTipoNota, Value)
            End Set
        End Property

        Public Overridable Property DireccionEntrega As String
            Get
                Return MyBase.Getstring(ColumnNames.DireccionEntrega)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.DireccionEntrega, Value)
            End Set
        End Property

        Public Overridable Property FechaVencimiento As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaVencimiento)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaVencimiento, Value)
            End Set
        End Property

        Public Overridable Property CodOrdenCompra As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodOrdenCompra)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodOrdenCompra, Value)
            End Set
        End Property

        Public Overridable Property Observaciones As String
            Get
                Return MyBase.Getstring(ColumnNames.Observaciones)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Observaciones, Value)
            End Set
        End Property

        Public Overridable Property CodUsuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodUsuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodUsuario, Value)
            End Set
        End Property

        Public Overridable Property FechaActualizacion As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaActualizacion)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaActualizacion, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodNota As String
			Get
				If Me.IsColumnNull(ColumnNames.CodNota) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodNota)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodNota)
				Else
					Me.CodNota = MyBase.SetintAsString(ColumnNames.CodNota, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_NroNota As String
			Get
				If Me.IsColumnNull(ColumnNames.NroNota) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.NroNota)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.NroNota)
				Else
					Me.NroNota = MyBase.SetintAsString(ColumnNames.NroNota, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodCliente As String
			Get
				If Me.IsColumnNull(ColumnNames.CodCliente) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodCliente)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodCliente)
				Else
					Me.CodCliente = MyBase.SetintAsString(ColumnNames.CodCliente, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fecha As String
			Get
				If Me.IsColumnNull(ColumnNames.Fecha) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fecha)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fecha)
				Else
					Me.Fecha = MyBase.SetDateTimeAsString(ColumnNames.Fecha, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodEstadoNota As String
			Get
				If Me.IsColumnNull(ColumnNames.CodEstadoNota) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodEstadoNota)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodEstadoNota)
				Else
					Me.CodEstadoNota = MyBase.SetintAsString(ColumnNames.CodEstadoNota, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodContacto As String
			Get
				If Me.IsColumnNull(ColumnNames.CodContacto) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodContacto)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodContacto)
				Else
					Me.CodContacto = MyBase.SetintAsString(ColumnNames.CodContacto, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Total As String
			Get
				If Me.IsColumnNull(ColumnNames.Total) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.Total)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Total)
				Else
					Me.Total = MyBase.SetdecimalAsString(ColumnNames.Total, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodTipoNota As String
			Get
				If Me.IsColumnNull(ColumnNames.CodTipoNota) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodTipoNota)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodTipoNota)
				Else
					Me.CodTipoNota = MyBase.SetintAsString(ColumnNames.CodTipoNota, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_DireccionEntrega As String
			Get
				If Me.IsColumnNull(ColumnNames.DireccionEntrega) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.DireccionEntrega)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.DireccionEntrega)
				Else
					Me.DireccionEntrega = MyBase.SetstringAsString(ColumnNames.DireccionEntrega, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaVencimiento As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaVencimiento) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaVencimiento)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaVencimiento)
				Else
					Me.FechaVencimiento = MyBase.SetDateTimeAsString(ColumnNames.FechaVencimiento, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodOrdenCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.CodOrdenCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodOrdenCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodOrdenCompra)
				Else
					Me.CodOrdenCompra = MyBase.SetintAsString(ColumnNames.CodOrdenCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Observaciones As String
			Get
				If Me.IsColumnNull(ColumnNames.Observaciones) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Observaciones)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Observaciones)
				Else
					Me.Observaciones = MyBase.SetstringAsString(ColumnNames.Observaciones, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodUsuario As String
			Get
				If Me.IsColumnNull(ColumnNames.CodUsuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodUsuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodUsuario)
				Else
					Me.CodUsuario = MyBase.SetintAsString(ColumnNames.CodUsuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaActualizacion As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaActualizacion) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaActualizacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaActualizacion)
				Else
					Me.FechaActualizacion = MyBase.SetDateTimeAsString(ColumnNames.FechaActualizacion, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodNota() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodNota, Parameters.CodNota)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property NroNota() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.NroNota, Parameters.NroNota)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodCliente() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodCliente, Parameters.CodCliente)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fecha() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fecha, Parameters.Fecha)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodEstadoNota() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodEstadoNota, Parameters.CodEstadoNota)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodContacto() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodContacto, Parameters.CodContacto)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Total() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Total, Parameters.Total)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodTipoNota() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodTipoNota, Parameters.CodTipoNota)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property DireccionEntrega() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.DireccionEntrega, Parameters.DireccionEntrega)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaVencimiento() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaVencimiento, Parameters.FechaVencimiento)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodOrdenCompra() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodOrdenCompra, Parameters.CodOrdenCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Observaciones() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Observaciones, Parameters.Observaciones)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodUsuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaActualizacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodNota() As WhereParameter 
			Get
				If _CodNota_W Is Nothing Then
					_CodNota_W = TearOff.CodNota
				End If
				Return _CodNota_W
			End Get
		End Property

		Public ReadOnly Property NroNota() As WhereParameter 
			Get
				If _NroNota_W Is Nothing Then
					_NroNota_W = TearOff.NroNota
				End If
				Return _NroNota_W
			End Get
		End Property

		Public ReadOnly Property CodCliente() As WhereParameter 
			Get
				If _CodCliente_W Is Nothing Then
					_CodCliente_W = TearOff.CodCliente
				End If
				Return _CodCliente_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As WhereParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodEstadoNota() As WhereParameter 
			Get
				If _CodEstadoNota_W Is Nothing Then
					_CodEstadoNota_W = TearOff.CodEstadoNota
				End If
				Return _CodEstadoNota_W
			End Get
		End Property

		Public ReadOnly Property CodContacto() As WhereParameter 
			Get
				If _CodContacto_W Is Nothing Then
					_CodContacto_W = TearOff.CodContacto
				End If
				Return _CodContacto_W
			End Get
		End Property

		Public ReadOnly Property Total() As WhereParameter 
			Get
				If _Total_W Is Nothing Then
					_Total_W = TearOff.Total
				End If
				Return _Total_W
			End Get
		End Property

		Public ReadOnly Property CodTipoNota() As WhereParameter 
			Get
				If _CodTipoNota_W Is Nothing Then
					_CodTipoNota_W = TearOff.CodTipoNota
				End If
				Return _CodTipoNota_W
			End Get
		End Property

		Public ReadOnly Property DireccionEntrega() As WhereParameter 
			Get
				If _DireccionEntrega_W Is Nothing Then
					_DireccionEntrega_W = TearOff.DireccionEntrega
				End If
				Return _DireccionEntrega_W
			End Get
		End Property

		Public ReadOnly Property FechaVencimiento() As WhereParameter 
			Get
				If _FechaVencimiento_W Is Nothing Then
					_FechaVencimiento_W = TearOff.FechaVencimiento
				End If
				Return _FechaVencimiento_W
			End Get
		End Property

		Public ReadOnly Property CodOrdenCompra() As WhereParameter 
			Get
				If _CodOrdenCompra_W Is Nothing Then
					_CodOrdenCompra_W = TearOff.CodOrdenCompra
				End If
				Return _CodOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property Observaciones() As WhereParameter 
			Get
				If _Observaciones_W Is Nothing Then
					_Observaciones_W = TearOff.Observaciones
				End If
				Return _Observaciones_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As WhereParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As WhereParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Private _CodNota_W As WhereParameter = Nothing
		Private _NroNota_W As WhereParameter = Nothing
		Private _CodCliente_W As WhereParameter = Nothing
		Private _Fecha_W As WhereParameter = Nothing
		Private _CodEstadoNota_W As WhereParameter = Nothing
		Private _CodContacto_W As WhereParameter = Nothing
		Private _Total_W As WhereParameter = Nothing
		Private _CodTipoNota_W As WhereParameter = Nothing
		Private _DireccionEntrega_W As WhereParameter = Nothing
		Private _FechaVencimiento_W As WhereParameter = Nothing
		Private _CodOrdenCompra_W As WhereParameter = Nothing
		Private _Observaciones_W As WhereParameter = Nothing
		Private _CodUsuario_W As WhereParameter = Nothing
		Private _FechaActualizacion_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodNota_W = Nothing
			_NroNota_W = Nothing
			_CodCliente_W = Nothing
			_Fecha_W = Nothing
			_CodEstadoNota_W = Nothing
			_CodContacto_W = Nothing
			_Total_W = Nothing
			_CodTipoNota_W = Nothing
			_DireccionEntrega_W = Nothing
			_FechaVencimiento_W = Nothing
			_CodOrdenCompra_W = Nothing
			_Observaciones_W = Nothing
			_CodUsuario_W = Nothing
			_FechaActualizacion_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodNota() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodNota, Parameters.CodNota)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property NroNota() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.NroNota, Parameters.NroNota)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodCliente() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodCliente, Parameters.CodCliente)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fecha, Parameters.Fecha)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodEstadoNota() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodEstadoNota, Parameters.CodEstadoNota)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodContacto() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodContacto, Parameters.CodContacto)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Total() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Total, Parameters.Total)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodTipoNota() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodTipoNota, Parameters.CodTipoNota)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property DireccionEntrega() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.DireccionEntrega, Parameters.DireccionEntrega)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaVencimiento() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaVencimiento, Parameters.FechaVencimiento)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodOrdenCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodOrdenCompra, Parameters.CodOrdenCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Observaciones() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Observaciones, Parameters.Observaciones)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodNota() As AggregateParameter 
			Get
				If _CodNota_W Is Nothing Then
					_CodNota_W = TearOff.CodNota
				End If
				Return _CodNota_W
			End Get
		End Property

		Public ReadOnly Property NroNota() As AggregateParameter 
			Get
				If _NroNota_W Is Nothing Then
					_NroNota_W = TearOff.NroNota
				End If
				Return _NroNota_W
			End Get
		End Property

		Public ReadOnly Property CodCliente() As AggregateParameter 
			Get
				If _CodCliente_W Is Nothing Then
					_CodCliente_W = TearOff.CodCliente
				End If
				Return _CodCliente_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodEstadoNota() As AggregateParameter 
			Get
				If _CodEstadoNota_W Is Nothing Then
					_CodEstadoNota_W = TearOff.CodEstadoNota
				End If
				Return _CodEstadoNota_W
			End Get
		End Property

		Public ReadOnly Property CodContacto() As AggregateParameter 
			Get
				If _CodContacto_W Is Nothing Then
					_CodContacto_W = TearOff.CodContacto
				End If
				Return _CodContacto_W
			End Get
		End Property

		Public ReadOnly Property Total() As AggregateParameter 
			Get
				If _Total_W Is Nothing Then
					_Total_W = TearOff.Total
				End If
				Return _Total_W
			End Get
		End Property

		Public ReadOnly Property CodTipoNota() As AggregateParameter 
			Get
				If _CodTipoNota_W Is Nothing Then
					_CodTipoNota_W = TearOff.CodTipoNota
				End If
				Return _CodTipoNota_W
			End Get
		End Property

		Public ReadOnly Property DireccionEntrega() As AggregateParameter 
			Get
				If _DireccionEntrega_W Is Nothing Then
					_DireccionEntrega_W = TearOff.DireccionEntrega
				End If
				Return _DireccionEntrega_W
			End Get
		End Property

		Public ReadOnly Property FechaVencimiento() As AggregateParameter 
			Get
				If _FechaVencimiento_W Is Nothing Then
					_FechaVencimiento_W = TearOff.FechaVencimiento
				End If
				Return _FechaVencimiento_W
			End Get
		End Property

		Public ReadOnly Property CodOrdenCompra() As AggregateParameter 
			Get
				If _CodOrdenCompra_W Is Nothing Then
					_CodOrdenCompra_W = TearOff.CodOrdenCompra
				End If
				Return _CodOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property Observaciones() As AggregateParameter 
			Get
				If _Observaciones_W Is Nothing Then
					_Observaciones_W = TearOff.Observaciones
				End If
				Return _Observaciones_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Private _CodNota_W As AggregateParameter = Nothing
		Private _NroNota_W As AggregateParameter = Nothing
		Private _CodCliente_W As AggregateParameter = Nothing
		Private _Fecha_W As AggregateParameter = Nothing
		Private _CodEstadoNota_W As AggregateParameter = Nothing
		Private _CodContacto_W As AggregateParameter = Nothing
		Private _Total_W As AggregateParameter = Nothing
		Private _CodTipoNota_W As AggregateParameter = Nothing
		Private _DireccionEntrega_W As AggregateParameter = Nothing
		Private _FechaVencimiento_W As AggregateParameter = Nothing
		Private _CodOrdenCompra_W As AggregateParameter = Nothing
		Private _Observaciones_W As AggregateParameter = Nothing
		Private _CodUsuario_W As AggregateParameter = Nothing
		Private _FechaActualizacion_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodNota_W = Nothing
		_NroNota_W = Nothing
		_CodCliente_W = Nothing
		_Fecha_W = Nothing
		_CodEstadoNota_W = Nothing
		_CodContacto_W = Nothing
		_Total_W = Nothing
		_CodTipoNota_W = Nothing
		_DireccionEntrega_W = Nothing
		_FechaVencimiento_W = Nothing
		_CodOrdenCompra_W = Nothing
		_Observaciones_W = Nothing
		_CodUsuario_W = Nothing
		_FechaActualizacion_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_NOTASInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodNota.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_NOTASUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_NOTASDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodNota)
		p.SourceColumn = ColumnNames.CodNota
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodNota)
		p.SourceColumn = ColumnNames.CodNota
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.NroNota)
		p.SourceColumn = ColumnNames.NroNota
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodCliente)
		p.SourceColumn = ColumnNames.CodCliente
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fecha)
		p.SourceColumn = ColumnNames.Fecha
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodEstadoNota)
		p.SourceColumn = ColumnNames.CodEstadoNota
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodContacto)
		p.SourceColumn = ColumnNames.CodContacto
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Total)
		p.SourceColumn = ColumnNames.Total
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodTipoNota)
		p.SourceColumn = ColumnNames.CodTipoNota
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.DireccionEntrega)
		p.SourceColumn = ColumnNames.DireccionEntrega
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaVencimiento)
		p.SourceColumn = ColumnNames.FechaVencimiento
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodOrdenCompra)
		p.SourceColumn = ColumnNames.CodOrdenCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Observaciones)
		p.SourceColumn = ColumnNames.Observaciones
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodUsuario)
		p.SourceColumn = ColumnNames.CodUsuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaActualizacion)
		p.SourceColumn = ColumnNames.FechaActualizacion
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

